from t_celery import app
from celery.result import AsyncResult
# 关键字，变量不能定义为关键字
id = '2bd544e2-d994-4e86-94ad-13549fa4903a'

if __name__ == '__main__':
    res = AsyncResult(id=id, app=app)
    if res.successful():
        result = res.get() #获取执行的结果
        print(result)
    elif res.failed():
        print('任务失败')
    elif res.status == 'PENDING':
        print('任务等待被执行')
    elif res.status == 'RETRY':
        print('任务异常后正在重试')
    elif res.status == 'STARTED':
        print('任务已经开始被执行')